<?php /*a:2:{s:39:"D:\www\long_shop\app\view\cat\edit.html";i:1709380918;s:42:"D:\www\long_shop\app\view\common\head.html";i:1702389678;}*/ ?>
<!DOCTYPE html>
<html>
<head>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <script src="/static/jquery/jquery-1.12.4.min.js"></script>    
    <link href="/static/bst5.3.2/css/bootstrap.min.css" rel="stylesheet">
    <script src="/static/bst5.3.2/js/bootstrap.bundle.min.js"></script>
    <link rel="stylesheet" href="/static/bst-icons/font/bootstrap-icons.css">
    <script src="/static/layer/layer/layer.js"></script>
    <link rel="stylesheet" href="/static/css/my.css">    
</head>
<head>
<title>分类编辑</title>
<style type="text/css">
  .form-controlx{width: initial;display: inline-block;}
</style>
</head>
<body style="">
    <div class="container p-3 my-3 " style="max-width: 600px;"  >
    <h2>分类编辑</h2>
    <form method="post" enctype="multipart/form-data" action="/index.php/cat/edit">

      <input type="hidden" name="id" id="id" value="<?php echo htmlentities($data['id']); ?>" />

       <div class="mb-3 mt-3">
        <lable for="fid" class="form-label">父类(Categray):</label>

        <select id="fid" name="fid" class="form-control">
            <?php foreach($category as $k=>$v): ?>
            <option value="<?php echo htmlentities($k); ?>" <?php if($data['fid']==$v['id']): ?>selected<?php endif; ?> >
              <?php if($v['deepth']==1): ?>
                |__
              <?php elseif($v['deepth']==2): ?>
                &nbsp;&nbsp;&nbsp;&nbsp;|
              <?php elseif($v['deepth']==3): ?>
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|__         
              <?php endif; ?>
              <?php echo htmlentities($v['name']); ?>
              </option>
            <?php endforeach; ?> 
        </select>

      </div>
      <div class="mb-3 mt-3">
        <lable for="name" class="form-label">名称:</label>
        <input type="text" class="form-control" id="name" name="name" value="<?php echo htmlentities($data['name']); ?>" placeholder="Goods name" />
      </div>
      <div class="mb-3">
        <label for="title" class="form-label">说明:</label>
        <input type="text" class="form-control" id="title" name="title" value="<?php echo htmlentities($data['title']); ?>" placeholder="Title" />
      </div>  

      <div class="mb-3">
        <label for="sort" class="form-label">排序:</label>
        <input type="text" class="form-control" id="sort" name="sort" value="<?php echo htmlentities($data['sort']); ?>" placeholder="Sort" />
      </div>


      <div class="mb-3 text-center">
        <label for="price_per_km" class="form-label">图(image):</label>        
        <img id="img" src="<?php echo htmlentities($data['img']); ?>" style="width:90px;min-width: 90px;min-height: 30px;border: 1px solid #ccc;margin:0 auto;" alt="Image" />
        <input type="file"  name="file" id="file"  /> <br> 
       </div>



      <div class="mb-3">
        <label for="status" class="form-label">是否启用(Using):</label>
          <input type="radio" class="form-check-input" id="radio1" name="status" value="1" <?php if($data['status']==1): ?> checked <?php endif; ?>/> 
          <label class="form-check-label" for="radio1">启用(Using)</label>
          <input type="radio" class="form-check-input" id="radio2" name="status" value="2" <?php if($data['status']==2): ?> checked <?php endif; ?>/>
          <label class="form-check-label" for="radio2">停用(Stoped)</label>
       </div>
      <button  type="button" class="btn btn-primary" onclick="doSave()">保存(Save)</button>

    </form>
    </div>

<script type="text/javascript">
    function doSave(){
      if(!$("#name").val()) {
        layer.msg("无效的分类名称(Invalid category name)!");
        return 0;
      }    
      //询问框
      layer.confirm('是否确定保存分类?', {
        btn: ['YES','CANCEL'] //按钮
      }, function(){
        $('form').submit();
      }, function(){
        layer.msg("Cancel!");
        return 0;
      });
    }

</script>


</body>
</html>
